using System; 
using System.Text; 
using System.Data;
using System.Data.SqlClient;
using System.Data.Common;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Configuration; 
using System.Xml; 
using System.Xml.Serialization;
using SubSonic; 
using SubSonic.Utilities;

namespace Adex{
    /// <summary>
    /// Strongly-typed collection for the VTrafficLog class.
    /// </summary>
    [Serializable]
    public partial class VTrafficLogCollection : ReadOnlyList<VTrafficLog, VTrafficLogCollection>
    {        
        public VTrafficLogCollection() {}

    }

    /// <summary>
    /// This is  Read-only wrapper class for the vTrafficLog view.
    /// </summary>
    [Serializable]
    public partial class VTrafficLog : ReadOnlyRecord<VTrafficLog> 
    {
    
	    #region Default Settings
	    protected static void SetSQLProps() 
	    {
		    GetTableSchema();
	    }

	    #endregion
        #region Schema Accessor
	    public static TableSchema.Table Schema
        {
            get
            {
                if (BaseSchema == null)
                {
                    SetSQLProps();
                }

                return BaseSchema;
            }

        }

    	
        private static void GetTableSchema() 
        {
            if(!IsSchemaInitialized)
            {
                //Schema declaration
                TableSchema.Table schema = new TableSchema.Table("vTrafficLog", TableType.View, DataService.GetInstance("Adex"));
                schema.Columns = new TableSchema.TableColumnCollection();
                schema.SchemaName = "dbo";
                //columns
                
                TableSchema.TableColumn colvarMediaTypeName = new TableSchema.TableColumn(schema);
                colvarMediaTypeName.ColumnName = "MediaTypeName";
                colvarMediaTypeName.DataType = DbType.String;
                colvarMediaTypeName.MaxLength = 50;
                colvarMediaTypeName.AutoIncrement = false;
                colvarMediaTypeName.IsNullable = true;
                colvarMediaTypeName.IsPrimaryKey = false;
                colvarMediaTypeName.IsForeignKey = false;
                colvarMediaTypeName.IsReadOnly = false;
                
                schema.Columns.Add(colvarMediaTypeName);
                
                TableSchema.TableColumn colvarMediaName = new TableSchema.TableColumn(schema);
                colvarMediaName.ColumnName = "MediaName";
                colvarMediaName.DataType = DbType.String;
                colvarMediaName.MaxLength = 255;
                colvarMediaName.AutoIncrement = false;
                colvarMediaName.IsNullable = true;
                colvarMediaName.IsPrimaryKey = false;
                colvarMediaName.IsForeignKey = false;
                colvarMediaName.IsReadOnly = false;
                
                schema.Columns.Add(colvarMediaName);
                
                TableSchema.TableColumn colvarMediaType = new TableSchema.TableColumn(schema);
                colvarMediaType.ColumnName = "MediaTypeCode";
                colvarMediaType.DataType = DbType.Int32;
                colvarMediaType.MaxLength = 0;
                colvarMediaType.AutoIncrement = false;
                colvarMediaType.IsNullable = true;
                colvarMediaType.IsPrimaryKey = false;
                colvarMediaType.IsForeignKey = false;
                colvarMediaType.IsReadOnly = false;
                
                schema.Columns.Add(colvarMediaType);
                
                TableSchema.TableColumn colvarTrafficLogID = new TableSchema.TableColumn(schema);
                colvarTrafficLogID.ColumnName = "TrafficLogID";
                colvarTrafficLogID.DataType = DbType.Int32;
                colvarTrafficLogID.MaxLength = 0;
                colvarTrafficLogID.AutoIncrement = false;
                colvarTrafficLogID.IsNullable = false;
                colvarTrafficLogID.IsPrimaryKey = false;
                colvarTrafficLogID.IsForeignKey = false;
                colvarTrafficLogID.IsReadOnly = false;
                
                schema.Columns.Add(colvarTrafficLogID);
                
                TableSchema.TableColumn colvarMediaCode = new TableSchema.TableColumn(schema);
                colvarMediaCode.ColumnName = "MediaCode";
                colvarMediaCode.DataType = DbType.String;
                colvarMediaCode.MaxLength = 50;
                colvarMediaCode.AutoIncrement = false;
                colvarMediaCode.IsNullable = true;
                colvarMediaCode.IsPrimaryKey = false;
                colvarMediaCode.IsForeignKey = false;
                colvarMediaCode.IsReadOnly = false;
                
                schema.Columns.Add(colvarMediaCode);
                
                TableSchema.TableColumn colvarMonday = new TableSchema.TableColumn(schema);
                colvarMonday.ColumnName = "Monday";
                colvarMonday.DataType = DbType.Int32;
                colvarMonday.MaxLength = 0;
                colvarMonday.AutoIncrement = false;
                colvarMonday.IsNullable = true;
                colvarMonday.IsPrimaryKey = false;
                colvarMonday.IsForeignKey = false;
                colvarMonday.IsReadOnly = false;
                
                schema.Columns.Add(colvarMonday);
                
                TableSchema.TableColumn colvarTuesday = new TableSchema.TableColumn(schema);
                colvarTuesday.ColumnName = "Tuesday";
                colvarTuesday.DataType = DbType.Int32;
                colvarTuesday.MaxLength = 0;
                colvarTuesday.AutoIncrement = false;
                colvarTuesday.IsNullable = true;
                colvarTuesday.IsPrimaryKey = false;
                colvarTuesday.IsForeignKey = false;
                colvarTuesday.IsReadOnly = false;
                
                schema.Columns.Add(colvarTuesday);
                
                TableSchema.TableColumn colvarWednesday = new TableSchema.TableColumn(schema);
                colvarWednesday.ColumnName = "Wednesday";
                colvarWednesday.DataType = DbType.Int32;
                colvarWednesday.MaxLength = 0;
                colvarWednesday.AutoIncrement = false;
                colvarWednesday.IsNullable = true;
                colvarWednesday.IsPrimaryKey = false;
                colvarWednesday.IsForeignKey = false;
                colvarWednesday.IsReadOnly = false;
                
                schema.Columns.Add(colvarWednesday);
                
                TableSchema.TableColumn colvarThursday = new TableSchema.TableColumn(schema);
                colvarThursday.ColumnName = "Thursday";
                colvarThursday.DataType = DbType.Int32;
                colvarThursday.MaxLength = 0;
                colvarThursday.AutoIncrement = false;
                colvarThursday.IsNullable = true;
                colvarThursday.IsPrimaryKey = false;
                colvarThursday.IsForeignKey = false;
                colvarThursday.IsReadOnly = false;
                
                schema.Columns.Add(colvarThursday);
                
                TableSchema.TableColumn colvarFriday = new TableSchema.TableColumn(schema);
                colvarFriday.ColumnName = "Friday";
                colvarFriday.DataType = DbType.Int32;
                colvarFriday.MaxLength = 0;
                colvarFriday.AutoIncrement = false;
                colvarFriday.IsNullable = true;
                colvarFriday.IsPrimaryKey = false;
                colvarFriday.IsForeignKey = false;
                colvarFriday.IsReadOnly = false;
                
                schema.Columns.Add(colvarFriday);
                
                TableSchema.TableColumn colvarSaturday = new TableSchema.TableColumn(schema);
                colvarSaturday.ColumnName = "Saturday";
                colvarSaturday.DataType = DbType.Int32;
                colvarSaturday.MaxLength = 0;
                colvarSaturday.AutoIncrement = false;
                colvarSaturday.IsNullable = true;
                colvarSaturday.IsPrimaryKey = false;
                colvarSaturday.IsForeignKey = false;
                colvarSaturday.IsReadOnly = false;
                
                schema.Columns.Add(colvarSaturday);
                
                TableSchema.TableColumn colvarSunday = new TableSchema.TableColumn(schema);
                colvarSunday.ColumnName = "Sunday";
                colvarSunday.DataType = DbType.Int32;
                colvarSunday.MaxLength = 0;
                colvarSunday.AutoIncrement = false;
                colvarSunday.IsNullable = true;
                colvarSunday.IsPrimaryKey = false;
                colvarSunday.IsForeignKey = false;
                colvarSunday.IsReadOnly = false;
                
                schema.Columns.Add(colvarSunday);
                
                TableSchema.TableColumn colvarDateAdded = new TableSchema.TableColumn(schema);
                colvarDateAdded.ColumnName = "DateAdded";
                colvarDateAdded.DataType = DbType.DateTime;
                colvarDateAdded.MaxLength = 0;
                colvarDateAdded.AutoIncrement = false;
                colvarDateAdded.IsNullable = true;
                colvarDateAdded.IsPrimaryKey = false;
                colvarDateAdded.IsForeignKey = false;
                colvarDateAdded.IsReadOnly = false;
                
                schema.Columns.Add(colvarDateAdded);
                
                TableSchema.TableColumn colvarDateModified = new TableSchema.TableColumn(schema);
                colvarDateModified.ColumnName = "DateModified";
                colvarDateModified.DataType = DbType.DateTime;
                colvarDateModified.MaxLength = 0;
                colvarDateModified.AutoIncrement = false;
                colvarDateModified.IsNullable = true;
                colvarDateModified.IsPrimaryKey = false;
                colvarDateModified.IsForeignKey = false;
                colvarDateModified.IsReadOnly = false;
                
                schema.Columns.Add(colvarDateModified);
                
                
                BaseSchema = schema;
                //add this schema to the provider
                //so we can query it later
                DataService.Providers["Adex"].AddSchema("vTrafficLog",schema);
            }

        }

        #endregion
        
        #region Query Accessor
	    public static Query CreateQuery()
	    {
		    return new Query(Schema);
	    }

	    #endregion
	    
	    #region .ctors
	    public VTrafficLog()
	    {
            SetSQLProps();
            SetDefaults();
            MarkNew();
        }

        public VTrafficLog(bool useDatabaseDefaults)
	    {
		    SetSQLProps();
		    if(useDatabaseDefaults)
		    {
				ForceDefaults();
			}

			MarkNew();
	    }

	    
	    public VTrafficLog(object keyID)
	    {
		    SetSQLProps();
		    LoadByKey(keyID);
	    }

    	 
	    public VTrafficLog(string columnName, object columnValue)
        {
            SetSQLProps();
            LoadByParam(columnName,columnValue);
        }

        
	    #endregion
	    
	    #region Props
	    
          
        [XmlAttribute("MediaTypeName")]
        public string MediaTypeName 
	    {
		    get
		    {
			    return GetColumnValue<string>("MediaTypeName");
		    }

            set 
		    {
			    SetColumnValue("MediaTypeName", value);
            }

        }

	      
        [XmlAttribute("MediaName")]
        public string MediaName 
	    {
		    get
		    {
			    return GetColumnValue<string>("MediaName");
		    }

            set 
		    {
			    SetColumnValue("MediaName", value);
            }

        }

	      
        [XmlAttribute("MediaType")]
        public int? MediaType 
	    {
		    get
		    {
			    return GetColumnValue<int?>("MediaTypeCode");
		    }

            set 
		    {
			    SetColumnValue("MediaTypeCode", value);
            }

        }

	      
        [XmlAttribute("TrafficLogID")]
        public int TrafficLogID 
	    {
		    get
		    {
			    return GetColumnValue<int>("TrafficLogID");
		    }

            set 
		    {
			    SetColumnValue("TrafficLogID", value);
            }

        }

	      
        [XmlAttribute("MediaCode")]
        public string MediaCode 
	    {
		    get
		    {
			    return GetColumnValue<string>("MediaCode");
		    }

            set 
		    {
			    SetColumnValue("MediaCode", value);
            }

        }

	      
        [XmlAttribute("Monday")]
        public int? Monday 
	    {
		    get
		    {
			    return GetColumnValue<int?>("Monday");
		    }

            set 
		    {
			    SetColumnValue("Monday", value);
            }

        }

	      
        [XmlAttribute("Tuesday")]
        public int? Tuesday 
	    {
		    get
		    {
			    return GetColumnValue<int?>("Tuesday");
		    }

            set 
		    {
			    SetColumnValue("Tuesday", value);
            }

        }

	      
        [XmlAttribute("Wednesday")]
        public int? Wednesday 
	    {
		    get
		    {
			    return GetColumnValue<int?>("Wednesday");
		    }

            set 
		    {
			    SetColumnValue("Wednesday", value);
            }

        }

	      
        [XmlAttribute("Thursday")]
        public int? Thursday 
	    {
		    get
		    {
			    return GetColumnValue<int?>("Thursday");
		    }

            set 
		    {
			    SetColumnValue("Thursday", value);
            }

        }

	      
        [XmlAttribute("Friday")]
        public int? Friday 
	    {
		    get
		    {
			    return GetColumnValue<int?>("Friday");
		    }

            set 
		    {
			    SetColumnValue("Friday", value);
            }

        }

	      
        [XmlAttribute("Saturday")]
        public int? Saturday 
	    {
		    get
		    {
			    return GetColumnValue<int?>("Saturday");
		    }

            set 
		    {
			    SetColumnValue("Saturday", value);
            }

        }

	      
        [XmlAttribute("Sunday")]
        public int? Sunday 
	    {
		    get
		    {
			    return GetColumnValue<int?>("Sunday");
		    }

            set 
		    {
			    SetColumnValue("Sunday", value);
            }

        }

	      
        [XmlAttribute("DateAdded")]
        public DateTime? DateAdded 
	    {
		    get
		    {
			    return GetColumnValue<DateTime?>("DateAdded");
		    }

            set 
		    {
			    SetColumnValue("DateAdded", value);
            }

        }

	      
        [XmlAttribute("DateModified")]
        public DateTime? DateModified 
	    {
		    get
		    {
			    return GetColumnValue<DateTime?>("DateModified");
		    }

            set 
		    {
			    SetColumnValue("DateModified", value);
            }

        }

	    
	    #endregion
    
	    #region Columns Struct
	    public struct Columns
	    {
		    
		    
            public static string MediaTypeName = @"MediaTypeName";
            
            public static string MediaName = @"MediaName";
            
            public static string MediaType = @"MediaTypeCode";
            
            public static string TrafficLogID = @"TrafficLogID";
            
            public static string MediaCode = @"MediaCode";
            
            public static string Monday = @"Monday";
            
            public static string Tuesday = @"Tuesday";
            
            public static string Wednesday = @"Wednesday";
            
            public static string Thursday = @"Thursday";
            
            public static string Friday = @"Friday";
            
            public static string Saturday = @"Saturday";
            
            public static string Sunday = @"Sunday";
            
            public static string DateAdded = @"DateAdded";
            
            public static string DateModified = @"DateModified";
            
	    }

	    #endregion
    }

}

